* Mattes and Weeks "APOLOGY DIPLOMACY: THE INTERNATIONAL IMAGE EFFECTS OF INTERSTATE APOLOGIES"

* This do-file contains code for the following in the following order (you can search on name of section to locate):
* STUDY 1
	* 1) Processing of data from Study 1
	* 2) Main analyses of Study 1
	* 3) Supplemental analyses of Study 1
* STUDY 2
	* 4) Processing of data from Study 2
	* 5) Main analyses of Study 2
	* 6) Supplemental analyses of Study 2

* Please see accompanying R file ("Figures") for code to create all four figures. 

********************************************************************************************************************
*************************************************** STUDY 1 ********************************************************
********************************************************************************************************************


* Set directory
*cd "/Users/jessicaweeks/Dropbox/HawksDoves/Apologies/Apologies--Image/Submission/IO/Resubmit/Conditional Accept/Replication Data"
 cd "/Users/mmattes/Library/CloudStorage/Dropbox/HawksDoves/Apologies/Apologies--Image/Submission/IO/Resubmit/Conditional Accept/Replication Data"

version 17
clear
program drop _all

**********************************************************************************************************************************
******************************************** 1) PROCESSING OF DATA FROM STUDY 1 **************************************************
**********************************************************************************************************************************

use "raw_data_Study_1.dta", clear // load raw data from Study 1

****************************************
* CLEAN UP DATA AND GENERATE VARIABLES *
****************************************

keep if status==0 // drop the previews
count


*********************************
* PRETREATMENT ATTENTION CHECKS *
*********************************

foreach x in 1 2 3 {
gen attn`x'p=0
replace attn`x'p=1 if attn`x'=="pass"
}
gen passpresum=attn1p + attn2p + attn3p
tab passpresum

gen passpre1=0
replace passpre1=1 if attn1=="pass" & attn2=="pass" & attn3=="pass"
tab passpre1 // this shows what % of subjects did not pass the pretreatment attention checks: they did not proceed to experiment

drop if passpre1==0
count

keep if relig_impt!=. & particip!="" // drop people who did not complete our entire survey
count // 


**************
* TREATMENTS *
**************

tab apol_type // shows whether subject saw no apology, a "short" apology, or "long" apology (with information about backlash and target reaction)

* start to process treatment indicators 

* whether the sender (apologizer) is a democracy
gen dem=0
replace dem=1 if regime1=="democracy" // dem=1 if sender is democratic
tab dem regime1, nomiss

* whether there is sender backlash against the apology
gen backlash=0
replace backlash=1 if backlash_t=="yes" // backlash=1 if sender domestic backlash

* whether the target accepts the apology
replace accept_t="no" if accept_sum=="The Ukrainian president rejects the Russian apology."
gen accept=0
replace accept=1 if accept_t=="yes" // accept=1 if target accepts the apology

* whether there is an apology 
tab apol_type
gen apol=0 // no apology
replace apol=1 if apol_type=="short" // an apology was issued but respondents were given no further information (this is generally called "short" in the replication materials)
replace apol=2 if apol_type=="long" & backlash==1 & accept==0 // an apology was issued that was rejected and had backlash
replace apol=3 if apol_type=="long" & backlash==0 & accept==0 // an apology that was rejected but had no backlash
replace apol=4 if apol_type=="long" & backlash==1 & accept==1 // an apology that was accepted but had backlash
replace apol=5 if apol_type=="long" & backlash==0 & accept==1 // an apology that was accepted and had no backlash
label define apoll 0 "0 - No apol" 1 "1 - Short apol" 2 "2 - Rej w/backlash" 3 "3 - Rej w/out backlash" 4 "4 - Acc w/backlash" 5 "5 - Acc w/out backlash"
label values apol apoll

* now create apology treatment indicators used for some of the analyses
gen short=0
replace short=1 if apol==1 // an apology was issued but respondents were given no further information 

gen apol_reject=0
replace apol_reject=1 if apol>=2 & accept==0 // the apology is rejected (there may or may not have been backlash)
tab apol, sum(apol_reject)

gen apol_accept=0
replace apol_accept=1 if apol>=2 & accept==1 // the apology is accepted (there may or may not have been backlash)
tab apol, sum(apol_accept)

gen apol_backlash=0
replace apol_backlash=1 if apol>=2 & backlash==1 // there is backlash against the apology (the apology may or may not have been accepted by the target)
tab apol, sum(apol_backlash)


***********************
* DEPENDENT VARIABLES *
***********************

* Favorability
/*If events in 2030 happened just as we described, would you have a very favorable, somewhat favorable, somewhat unfavorable, or very unfavorable view of Russia? 
o	Very favorable  (1)  o	Somewhat favorable  (2)  o	Somewhat unfavorable  (3)  o	Very unfavorable  (4)  */
tab dv1_fav
* binary-- primary operationalization
gen dv_fav=0
replace dv_fav=100 if dv1_fav==1 | dv1_fav==2 // favorable=100 if very or somewhat favorable
tab dv_fav
* scale-- for robustness check
gen dv_fav100=dv1_fav
recode dv_fav100 1=100 2=66.67 3=33.33 4=0 // 4-point scale of favorability 
tab dv_fav100

* Cooperation
/*If events in 2030 happened just as we described, would you say that the U.S. should increase, decrease, or not change its level of cooperation with Russia?
o	Increase its level of cooperation  (1)  o	Not change its level of cooperation  (2)  o	Decrease its level of cooperation  (3)  */
tab dv2_coop_1
* binary-- primary operationalization
gen dv_coop=0
replace dv_coop=100 if dv2_coop_1==1 // cooperation=100 if increase coop 
tab dv_coop
* scale-- for robustness check
gen dv_coop100=dv2_coop_1
recode dv_coop100 1=100 2=50 3=0 // 100 is increase, 50 is not change, 0 is decrease
tab dv_coop100

* Buy
/*If events in 2030 happened just as we described, would you avoid buying products that you knew had been made in Russia?
Would definitely avoid buying  (1)  Would probably avoid buying  (2)  Would probably not avoid buying  (3)  Would definitely not avoid buying  (4) */
tab dv3_products 
* binary-- primary operationalization
gen dv_buy=0
replace dv_buy=100 if dv3_products>=3 // buy=100 if definitely not or probably not avoid buying
tab dv_buy
* scale-- for robustness check
gen dv_buy100=dv3_products
recode dv_buy100 1=0 2=33.33 3=66.67 4=100 // scale means more support for buying
tab dv3_products dv_buy100

* Weakness (Study 1)
/*If events in 2030 happened just as we described, would you agree or disagree with the following statement? "Russia is a force to be reckoned with."
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
tab dv1_weak_1
* binary-- primary operationalization
gen dv_weak=0
replace dv_weak=100 if dv1_weak_1>=4 // weak=100 if disagree strongly or somewhat that Russia is "a force to be reckoned with"
tab dv_weak
* scale-- for robustness check
gen dv_weak100=dv1_weak_1
recode dv_weak100 1=0 2=25 3=50 4=75 5=100 //  scale means more perceptions of weakness
tab dv1_weak_1 dv_weak100


**************
* MECHANISMS *
**************

* threat
/*If events in 2030 happened just as we described, would you agree or disagree that Russia represents a threat to international peace and stability?
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */ */
tab mech_threat_1
* binary-- primary operationalization
gen mech_threat=0
replace mech_threat=100 if mech_threat_1<=2 // threat=100 if agree strongly or somewhat that Russia represents threat
* scale-- for robustness check
gen mech_threat100=mech_threat_1
recode mech_threat100 1=100 2=75 3=50 4=25 5=0 // scale means more perception of threat
tab mech_threat100 mech_threat_1

* values
/*If events in 2030 happened just as we described, how much confidence would you have that Russia would generally "do the right thing" in world affairs?
o	A lot of confidence  (1)  o	Some confidence  (2)  o	Not too much confidence  (3)  o	No confidence at all  (4)  */
tab mech_values_1
* binary-- primary operationalization
gen mech_values=0
replace mech_values=100 if mech_values_1<=2 // values=100 if some or a lot of confidence
* scale-- for robustness check
gen mech_values100=mech_values_1
recode mech_values100 4=0 3=33.33 2=66.67 1=100 // scale means more perception of values
tab mech_values100 mech_values_1
 
* status
/*If events in 2030 happened just as we described, how much would you agree or disagree with the following statement? "Russia has a lot of status internationally."
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
gen mech_status=0
* binary-- primary operationalization
replace mech_status=100 if mech_status_1<=2 // status=100 if agree strongly or somewhat
tab mech_status mech_status_1
* scale-- for robustness check
gen mech_status100=mech_status_1
recode mech_status100 1=100 2=75 3=50 4=25 5=0 // scale means more perception of status
tab mech_status100 mech_status_1

* sincere 
/*If events in 2030 happened just as we described, would you agree or disagree that Russia feels that its invasion of Ukraine was wrong?
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
gen mech_sincere=0
* binary-- primary operationalization
replace mech_sincere=100 if mech_sincere_1<=2 // sincere=100 if agree strongly or somewhat
tab mech_sincere mech_sincere_1
* scale-- for robustness check
gen mech_sincere100=mech_sincere_1
recode mech_sincere100 1=100 2=75 3=50 4=25 5=0 // scale means  stronger perception of sincerity
tab mech_sincere100 mech_sincere_1


**************
* COVARIATES *
**************

* ideology (MW)
/*In general, do you think of yourself as . . .
o	Extremely liberal  (1) 
o	Liberal  (2) 
o	Slightly liberal  (3) 
o	Moderate, middle of the road  (4) 
o	Slightly conservative  (5) 
o	Conservative  (6) 
o	Extremely conservative  (7) 
*/
gen conservative=ideo7 // lower values mean more liberal, higher values more conservative

* party (Lucid)
/*"Generally Speaking, do you usually think yourself as a Republican, a Democrat, an Independent, or what?",,
political_party,1,Strong Democrat
political_party,2,Not very strong Democrat
political_party,3,Independent Democrat
political_party,4,Independent - neither
political_party,5,Independent Republican
political_party,6,Other - leaning Democrat
political_party,7,Other - neither
political_party,8,Other - leaning Republican
political_party,9,Not very strong Republican
political_party,10,Strong Republican
*/
gen pid10=political_party
gen pid3=.
replace pid3=1 if pid10<=3 | pid10==6 // Democrat
replace pid3=2 if pid10==4 | pid10==7 // Independent or 3rd party
replace pid3=3 if pid10==5 | pid10>=8 // Republican
label define pid3l 1 "Democrat" 2 "Independent or 3rd" 3 "Republican"
label values pid3 pid3l
tab pid10 pid3

* male (Lucid, "gender")
gen male = cond(gender == 1,1,0) // male-identifying respondent
label define malel 1 "Male" 0 "Other"
label values male malel
tab male

* age (Lucid, "in years") 
tab age // age in years

* race (Lucid, "ethnicity")
label define racel 1 "White" 2 "Black, or African American" 3 "American Indian or Alaska Native" 4 "Asian *** Asian Indian" 5 "Asian *** Chinese"  6 "Asian *** Filipino"  7 "Asian *** Japanese"  8 "Asian *** Korean" 9 "Asian *** Vietnamese" 10 "Asian *** Other" 11 "Pacific Islander *** Native Hawaiian"  12 "Pacific Islander *** Guamanian" 13 "Pacific Islander *** Samoan " 14 "Pacific Islander *** Other Pacific Islander" 15 "Some other race" 16	"Prefer not to answer" 
label values ethnicity racel
gen white = cond(ethnicity == 1,1,0) // responent identifies as white
tab white

* education (Lucid, "education")
tab education
replace education=. if educ<0
label define educll 1 "Some high school or less" 2 "High School Grad" 3 "Other post high school vocational" 4 "Some college" 5 "Associate's degree" 6 "Bachelor's degree" 7 "Master's or professional degree" 8 "PhD"
label values education educll
gen college=0
replace college=1 if education>=6 // respondent has college degree (doesn't count those in college)
tab college education

* hawkishness (MW)
/*The use of military force only makes problems worse. 
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
rename hawk5 hawk5_f
gen hawk5= (hawk5_f-1)/4 // 0-1 scale of hawkishness, with higher values meaning more hawkish

* international trust (MW)
/*Generally speaking, the U.S. can trust other nations. 
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
*/
recode trust 5=0 4=1 3=2 2=3 1=4 // recode so that higher values = greater trust
rename trust trust_f
gen trust= (trust_f-1)/4 // 0-1 scale of international trust, with higher values meaning more trust

* political interest (MW)
/*Would you say you follow what's going on in government and public affairs...?
o	Most of the time  (1)  o	Some of the time  (2)  o	Only now and then  (3)  o	Hardly at all  (4)  o	Don't know  (5)  */
gen polint = newsint
recode polint 4=0 3=1 2=2 1=3 5=0 *=. // recode so that higher values = more interest
rename polint polint_f
label define polint_fl 0 "Hardly at all" 1 "Only now and then" 2 "Some of the time" 3 "Most of the time"
label values polint_f polint_fl
gen polint= polint_f/3 // 0-1 scale of political interest, with higher values meaning more political interest
tab polint polint_f

* political activism (MW)
/*During the past year did you ... (Please check all that apply)
▢	Attend local political meetings (such as school board or city council)  (1) 
▢	Put up a political sign (such as a lawn sign or a bumper sticker)  (2) 
▢	Work for a candidate or campaign  (3) 
▢	Donate money to a candidate, campaign, or political organization  (4) 
▢	Donate blood  (5) 
▢	None of these  (6) 
Did you vote in the presidential election in November 2020?
o	No  (1) 
o	I usually vote, but did not in 2020  (2) 
o	I am not sure  (3) 
o	Yes. I definitely voted.  (4) 
Did you vote in the congressional election in November 2018?
o	No  (1) 
o	I usually vote, but did not in 2018  (2) 
o	I am not sure  (3) 
o	Yes. I definitely voted.  (4) 
*/
tab particip
rename particip particip_string
foreach x in  1 2 3 4 5 {
gen particip_`x'=0
replace particip_`x'=1 if strpos(particip_s, "`x'")
}
egen particip_f = rowtotal(particip_1 particip_2 particip_3 particip_4) // create count, but ignore donate blood = particip_5
gen particip = particip_f/4 // higher scores reflect greater political interest
recode voted20 4=1 1/3=0 *=. // voted=1 if yes in 2020
recode voted18 4=1 1/3=0 *=. // voted=1 if yes in 2018

* relig (MW)
/*How important is religion in your life? o	Very important  (1)  o	Somewhat important  (2)  o	Not too important  (3)  o	Not at all important  (4)  */
recode relig_impt 4=1 3=2 2=3 1=4 *=. // higher values = religion more important
rename relig_impt relig_impt_f
gen relig_impt= (relig_impt_f - 1)/3 // 0-1 scale, with higher values meaning more religious
tab relig_impt, miss

* Russia perceptions (MW)
/*Please say whether you consider Russia an ally of the United States, friendly, but not an ally, unfriendly, or an enemy of the United States.
o	Ally  (1)  o	Friendly, but not an ally  (2)  o	Unfriendly  (3)  o	Enemy  (4)  o	No opinion  (5)  */
gen enemy2 = 0
replace enemy2 = 1 if enemy_russia== 3 | enemy_russia==4 // enemy=1 if "unfriendly" or "enemy", codes no opinion as not enemy
label define enemy2l 0 "Not Enemy/Unfriendly" 1 "Enemy/Unfriendly"
label values enemy2 enemy2l


* Input variables for elite subsamples
* - income (Lucid, "hhi")
replace hhi=. if hhi==-3105
sum hhi, d
gen highinc=0
replace highinc=1 if hhi>6 // high income=1 if income above the median in the sample [which is 6]
tab highinc
* - prime age (Lucid, "age")
gen primeage=0
replace primeage=1 if age>=40 & age<65 // prime age=1 if between 40 and 65
tab primeage
* - high-educ (Lucid, "education")
gen higheduc=0
replace higheduc=1 if college==1 // high education=1 if college degree
* - high political interest (MW, "polint")
gen polinthi=0
replace polinthi=1 if polint>.5 // high political interest if follows news some or most of the time 
tab polinthi polint_f


* Generate elite subsets
* -	Elite 1: Male & High Income & High Educated & Prime Age
gen elite1=0
replace elite1=1 if male==1 & highinc==1 & higheduc==1 & primeage==1
* -	Elite 2: High Income & Highly Educated & Prime Age
gen elite2=0
replace elite2=1 if highinc==1 & higheduc==1 & primeage==1
* -	Elite 3: High Income & Highly Educate & Prime Age & High Political Interest
gen elite3=0
replace elite3=1 if highinc==1 & higheduc==1 & primeage==1 & polinthi==1
* -	Elite 4: Highly Educated & Prime Age & High Political Interest
gen elite4=0
replace elite4=1 if higheduc==1 & primeage==1 & polinthi==1
* -	Elite 5: Highly Educated & High Political Interest
gen elite5=0
replace elite5=1 if higheduc==1 & polinthi==1
* -	Elite 6: High Political Interest
gen elite6=0
replace elite6=1 if polinthi==1


**********************************
* POSTTREATMENT ATTENTION CHECKS *
**********************************

* diagnostic, not used to screen out respondents
tab mck_rel_1
tab scen2_mck_1 
tab scen3_mck_1 
tab scen4_mck_1 
tab scen5_mck_1 


***************************************
* DUMMIES FOR ANALYSES BELOW AND IN R *
***************************************

*Step 1
gen demshort=0
replace demshort=1 if dem==1 & short==1
label var demshort "Democracy, Short Apology"
gen demnone=0
replace demnone=1 if dem==1 & apol==0
label var demnone "Democracy, No Apology"
gen autshort=0
replace autshort=1 if dem==0 & short==1
label var autshort "Non-Democracy, Short Apology"
gen autnone=0
replace autnone=1 if dem==0 & apol==0
label var autnone "Non-Democracy, No Apology"

*Step 2
tab apol dem
gen demreject = 0 
replace demreject=1 if dem==1 & apol_reject==1
label var demreject "Democracy, Apology Rejected"
gen autreject  = 0 
replace autreject=1 if dem==0 & apol_reject==1
label var autreject "Non-Democracy, Apology Rejected"
gen demaccept = 0 
replace demaccept=1 if dem==1 & apol_accept==1
label var demaccept "Democracy, Apology Accepted"
gen autaccept = 0 
replace autaccept=1 if dem==0 & apol_accept==1
label var autaccept "Non-Democracy, Apology Accepted"

*Step 3
tab apol dem
gen dembacklash = 0 
replace dembacklash=1 if dem==1 & apol_backlash==1
label var dembacklash "Democracy, Backlash"
gen autbacklash = 0 
replace autbacklash=1 if dem==0 & apol_backlash==1
label var autbacklash "Non-Democracy, Backlash"
gen demnobacklash = 0 
replace demnobacklash=1 if dem==1 & apol_backlash==0 & apol_type=="long"
label var demnobacklash "Democracy, No Backlash"
gen autnobacklash = 0 
replace autnobacklash=1 if dem==0 & apol_backlash==0 & apol_type=="long"
label var autnobacklash "Non-Democracy, No Backlash"


***Save prepared data for making figures (in R) and appendix tables (in Stata)
count
save "Study1_prepped.dta", replace

**************************************************************************************************************************************************
********************************************************** 2) MAIN ANALYSES OF STUDY 1 ***********************************************************
**************************************************************************************************************************************************

* see R code to generate Figures

* STEP 1: EFFECT OF APOLOGY: What is the effect of an apology (short apology) relative to no apology? (analyses related to Figure 1)

/*H1: Effect of Apology. Relative to no apology, an apology…
a)	(Favorability) increases favorable views of the transgressor.
b)	(State-to-State Cooperation) increases support for state-to-state cooperation with the transgressor.
c)	(Private Transactions) increases willingness to transact privately with the transgressor.
d)	(Weakness): increases perceptions of weakness of the transgressor.*/


* Define program for analyses supporting Figure 1
program define fig1test
   di in r _n(2) "H1: Effect of apol if nondem"
		lincom autshort-autnone
   di in r _n(2) "H1: Effect of apol if dem"
		lincom demshort-demnone 
   di in r _n(2) "H2 & Q1: is the effect larger for a democ? (positive means yes; negative means aut effect larger)"
		lincom (demshort-demnone)-(autshort-autnone) // 
   di in r _n(2) "H3 & Q1: is the effect larger for an autoc? (positive means yes; negative means dem effect larger)"
		lincom (autshort-autnone)-(demshort-demnone) // 
   di in r _n(2) "H4: effect of transition if no apology"
		lincom demnone-autnone // 
   di in r _n(2) "Q2: Effect of apology if no transition, vs effect of democratization w no apol. Positive means apol larger effect."
		lincom (autshort-autnone) - (demnone-autnone) // 
		end

program define fig1main
foreach v of varlist dv_fav dv_coop dv_buy dv_weak {
   di in r _n(2) ".......... Variable is `v' .........."
   /*di in r _n(2) "... Crosstab, binary ..."
		tab short dem if apol_type!="long", sum(`v')*/
   di in r _n(2) "... OLS, binary, no controls ..."
		reg `v' autnone autshort demnone demshort if apol_type!="long", noconst
fig1test
   }
 end
fig1main


* STEP 2: TARGET REJECTION: Does the target's response moderate the effect of the apology? (Analyses related to Figure 3)

* H5 (Target Rejection, Conditional on Apology): Relative to the target accepting the apology, the target rejecting the apology …
	* a) decreases favorable views of the transgressor.  
	* b) decreases support for state-to-state cooperation with the transgressor.  
	* c) decreases willingness to transact privately with the transgressor. 
	* d) increases perceptions of weakness of the transgressor.

* H6 (Target Rejection, Compared to No Apology): Relative to no apology, a rejected apology ....
	* a) increases favorable views of the transgressor.
	* b) increases support for state-to-state cooperation with the transgressor.
	* c) increases willingness to transact privately with the transgressor.
	* d) increases perceptions of weakness of the transgressor.
	
* Per PAP, our comparison only focuses on cases in which there was no sender backlash. We carry out these tests separately for democratic and nondemocratic senders.


program define fig3main // analysis of rejected apol to accepted apol
   foreach v of varlist dv_fav dv_coop dv_buy dv_weak {
   di in r _n(2) ".......... Variable is `v' .........."
   di in r _n(2) "... OLS, binary, no controls ..."
		reg `v' autnone autreject autaccept demnone demreject demaccept if (apol==0 | apol==3 | apol==5), noconst // only no apol and long apol without backlash
		lincom autaccept-autreject // effect of reject if nondem
		lincom autreject-autnone // effect of apol w reject vs no apol if nondem
		lincom demaccept-demreject // effect of reject dem
		lincom demreject-demnone // effect of apol w reject vs no apol if dem
   }
end
fig3main


* STEP 3: BACKLASH: Does backlash in the sender country moderate the effect of the apology? (analyses related to Figure 4)

* H7 (Sender Backlash, Conditional on Apology): Relative to an apology without sender backlash, an apology with sender domestic backlash… 
	* i)	decreases favorable views of the transgressor.
	* ii)	decreases support for state-to-state cooperation with the transgressor.
	* iii)	decreases willingness to transact privately with the transgressor.
	
* H8 (Sender Backlash, Compared to No Apology): Relative to no apology, an apology with sender backlash ...
	* i) increases favorable views of the transgressor.
	* ii) increases support for state-to-state cooperation with the transgressor.
	* iii) Increases willingness to transact privately with the transgressor.

* Per PAP, we do this separately for each combination of dem and accept/reject.

* EFFECT OF BACKLASH IF TARGET ACCEPTS
program define fig4maina
foreach v of varlist dv_fav dv_coop dv_buy {
reg `v' autnone autbacklash autnobacklash demnone dembacklash demnobacklash if (apol==0 | apol==4 | apol==5), noconst	// ACCEPT
		lincom autbacklash-autnone
		lincom autnobacklash-autnone
		lincom dembacklash-demnone
		lincom demnobacklash-demnone
		lincom autbacklash-autnobacklash
		lincom dembacklash-demnobacklash 
}
end
fig4maina

* EFFECT OF BACKLASH IF TARGET REJECTS
program define fig4mainr
foreach v of varlist dv_fav dv_coop dv_buy {
reg `v' autnone autbacklash autnobacklash demnone dembacklash demnobacklash if (apol==0 | apol==2 | apol==3), noconst	// REJECT
		lincom autbacklash-autnone
		lincom autnobacklash-autnone
		lincom dembacklash-demnone
		lincom demnobacklash-demnone
		lincom autbacklash-autnobacklash
		lincom dembacklash-demnobacklash 
}
end
fig4mainr


***********************************************************************************************************************************************
*************************************************** 3) SUPPLEMENTAL ANALYSES OF STUDY 1 *******************************************************
***********************************************************************************************************************************************

program drop _all
clear
use "Study1_prepped.dta", clear

********************************
* Custom Programs for Analysis *
********************************

* Define a program to calculate difference-in-difference of marginal effects from logit models
program define logit_margins
    * Define inputs: logistic model, variable of interest, and variable for levels
    syntax anything, effect(varname) levels(varname)

    * Step 1: Estimate the user-specified logit model
    quietly logit `anything'

    * Step 2: Calculate marginal effects at the first level of the levels variable
    margins, dydx(`effect') at(`levels'=0)
    matrix me0 = r(b)
    matrix se0 = r(V)

    * Step 3: Calculate marginal effects at the second level of the levels variable
	margins, dydx(`effect') at(`levels'=1)
    matrix me1 = r(b)
    matrix se1 = r(V)

    * Step 4: Calculate the difference in marginal effects
    local diff = me1[1,2] - me0[1,2]

    * Step 5: Calculate the standard error of the difference
    local se_diff = sqrt(se1[2,2] + se0[2,2])

    * Step 6: Calculate the 95% confidence interval
    local lower_ci = `diff' - 1.96 * `se_diff'
    local upper_ci = `diff' + 1.96 * `se_diff'

    * Step 7: Calculate the z-statistic and p-value
    local z_value = `diff' / `se_diff'
    local p_value = 2 * (1 - normal(abs(`z_value')))

    * Step 8: Display the results
    display "Difference in Marginal Effects of `effect' at `levels'=1 vs `levels'=0: " %9.4f `diff'
    display "Standard Error of the Difference: " %9.4f `se_diff'
    display "95% Confidence Interval: [" %9.4f `lower_ci' ", " %9.4f `upper_ci' "]"
    display "z-value: " %9.4f `z_value'
    display "p-value: " %9.4f `p_value'
end

* Define a program to compare the predicted probabilities of two different effects from a logit model
program define compare_effects
    * Define inputs: logistic model and the two variables of interest
    syntax anything, effect1(varname) effect2(varname)

    * Step 1: Estimate the user-specified logit model
    quietly logit `anything'

    * Step 2: Calculate the marginal effect of the first variable when the second variable is at 0
    margins, dydx(`effect1') at(`effect2'=0)
    matrix me1 = r(b)
    matrix se1 = r(V)
    local me1_value = me1[1,2]  // Corrected index
    local se1_value = sqrt(se1[2,2])  // Corrected index

    * Step 3: Calculate the marginal effect of the second variable when the first variable is at 0
    margins, dydx(`effect2') at(`effect1'=0)
    matrix me2 = r(b)
    matrix se2 = r(V)
    local me2_value = me2[1,2]  // Corrected index
    local se2_value = sqrt(se2[2,2])  // Corrected index

    * Display the captured values for verification
    display "Marginal Effect of `effect1' when `effect2' = 0: " %9.4f `me1_value'
    display "Standard Error of `effect1' when `effect2' = 0: " %9.4f `se1_value'
    display "Marginal Effect of `effect2' when `effect1' = 0: " %9.4f `me2_value'
    display "Standard Error of `effect2' when `effect1' = 0: " %9.4f `se2_value'

    * Step 4: Calculate the difference in marginal effects
    local diff = `me1_value' - `me2_value'

    * Step 5: Calculate the standard error of the difference
    local se_diff = sqrt(`se1_value'^2 + `se2_value'^2)

    * Step 6: Calculate the 95% confidence interval
    local lower_ci = `diff' - 1.96 * `se_diff'
    local upper_ci = `diff' + 1.96 * `se_diff'

    * Step 7: Calculate the z-statistic and p-value
    local z_value = `diff' / `se_diff'
    local p_value = 2 * (1 - normal(abs(`z_value')))

    * Step 8: Display the final results
    display "Difference in Marginal Effects of `effect1' vs `effect2': " %9.4f `diff'
    display "Standard Error of the Difference: " %9.4f `se_diff'
    display "95% Confidence Interval: [" %9.4f `lower_ci' ", " %9.4f `upper_ci' "]"
    display "z-value: " %9.4f `z_value'
    display "p-value: " %9.4f `p_value'
end


*************************
* DESCRIPTIVES, STUDY 1 *
*************************

***control variables (Table B-1)
local controls conservative pid10 male age white college polint particip relig_impt hawk5 trust enemy2
sum `controls'

***elitelike sample components (Table B-2)
tab male
tab highinc
tab higheduc
tab primeage
tab polinthi

***subgroup analalysis (Table B-2)
tab pid3
tab hawk5_f
gen hawk=0
replace hawk=1 if hawk5_f>=4 // hawk=1 if disagree strongly or somewhat that "military force only makes problems worse"
gen dove=0
replace dove=1 if hawk5_f<=2 // dove=1 if agree strongly or somewhat that "military force only makes problems worse"
tab hawk
tab dove
tab enemy2
tab male

**********************************************************************************************************************************
******************************************** CODE TO CREATE APPENDIX TABLES, STUDY 1 *********************************************
**********************************************************************************************************************************

**************************
* MAIN ANALYSIS, STUDY 1 *
**************************

**** PART 1: Effect of Apology (H1a-d, H2, H3, H4, Q1, Q2) 

*** Favorability (Table C-1)

* define a program to compare effect of short (apology) at different levels of democ for OLS
program define postest1
    margins, dydx(short) at(dem=0)
    margins, dydx(short) at(dem=1)
    lincom (1.short#1.dem - 0.short#1.dem) - (1.short#0.dem - 0.short#0.dem)
    margins, dydx(dem) at(short=0)
    lincom 1.short - 1.dem
end

* define a program to compute quantities A, B, and D for logits
program define postest1logit
margins, dydx(short) at(dem=0) // Quantity A
margins, dydx(short) at(dem=1) // Quantity B
margins, dydx (dem) at(short=0) // Quantity D
end

* define a program to compare effect of short (apology) at different levels of democ for OLS models of weakness (omits irrelevant line)
program define postest1weak
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
lincom (1.short#1.dem - 0.short#1.dem) - (1.short#0.dem - 0.short#0.dem)
*margins, dydx (dem) at(short=0)
lincom 1.short  -  1.dem
end

**OLS, binary, no controls
reg dv_fav i.short##i.dem if apol_type!="long"
outreg2 using TableC-1.doc, replace ctitle (Model 1)
postest1

**OLS, binary, controls
reg dv_fav i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-1.doc, append ctitle (Model 2)
postest1

**OLS, scale, no controls
reg dv_fav100 i.short##i.dem if apol_type!="long"
outreg2 using TableC-1.doc, append ctitle (Model 3)
postest1

**OLS, scale, controls
reg dv_fav100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-1.doc, append ctitle (Model 4)
postest1

**Logit, binary, no controls
logit dv_fav i.short##i.dem if apol_type!="long"
outreg2 using TableC-1.doc, append ctitle (Model 3 - Logit)
postest1logit

preserve
keep if apol_type!="long" 
logit_margins dv_fav i.short##i.dem, effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_fav i.short##i.dem, effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore

**Logit, binary, controls
logit dv_fav i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-1.doc, append ctitle (Model 6)
postest1logit

preserve
keep if apol_type!="long" 
logit_margins dv_fav i.short##i.dem `controls', effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_fav i.short##i.dem `controls', effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore


*** Cooperation (Table C-2)

**OLS, binary, no controls
reg dv_coop i.short##i.dem if apol_type!="long"
outreg2 using TableC-2.doc, replace ctitle (Model 1)
postest1

**OLS, binary, controls
reg dv_coop i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-2.doc, append ctitle (Model 2)
postest1

**OLS, scale, no controls
reg dv_coop100 i.short##i.dem if apol_type!="long"
outreg2 using TableC-2.doc, append ctitle (Model 3)
postest1

**OLS, scale, controls
reg dv_coop100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-2.doc, append ctitle (Model 4)
postest1

**Logit, binary, no controls
logit dv_coop i.short##i.dem if apol_type!="long"
outreg2 using TableC-2.doc, append ctitle (Model 3 - Logit)
postest1logit

preserve
keep if apol_type!="long" 
logit_margins dv_coop i.short##i.dem, effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_coop i.short##i.dem, effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore

**Logit, binary, controls
logit dv_coop i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-2.doc, append ctitle (Model 6)
postest1logit
preserve
keep if apol_type!="long" 
logit_margins dv_coop i.short##i.dem `controls', effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_coop i.short##i.dem `controls', effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore


*** Buy (Table C-3)

**OLS, binary, no controls
reg dv_buy i.short##i.dem if apol_type!="long"
outreg2 using TableC-3.doc, replace ctitle (Model 1)
postest1

**OLS, binary, controls
reg dv_buy i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-3.doc, append ctitle (Model 2)
postest1

**OLS, scale, no controls
reg dv_buy100 i.short##i.dem if apol_type!="long"
outreg2 using TableC-3.doc, append ctitle (Model 3)
postest1

**OLS, scale, controls
reg dv_buy100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-3.doc, append ctitle (Model 4)
postest1

**Logit, binary, no controls
logit dv_buy i.short##i.dem if apol_type!="long"
outreg2 using TableC-3.doc, append ctitle (Model 3 - Logit)
postest1logit

preserve
keep if apol_type!="long"
logit_margins dv_buy i.short##i.dem, effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_buy i.short##i.dem, effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore

**Logit, binary, controls
logit dv_buy i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-3.doc, append ctitle (Model 6)
postest1logit

preserve
keep if apol_type!="long" 
logit_margins dv_buy i.short##i.dem `controls', effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_buy i.short##i.dem `controls', effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore


*** Weakness (Table C-4)

**OLS, binary, no controls
reg dv_weak i.short##i.dem if apol_type!="long"
outreg2 using TableC-4.doc, replace ctitle (Model 1)
postest1weak

**OLS, binary, controls
reg dv_weak i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-4.doc, append ctitle (Model 2)
postest1weak

**OLS, scale, no controls
reg dv_weak100 i.short##i.dem if apol_type!="long"
outreg2 using TableC-4.doc, append ctitle (Model 3)
postest1weak

**OLS, scale, controls
reg dv_weak100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-4.doc, append ctitle (Model 4)
postest1weak

**Logit, binary, no controls
logit dv_weak i.short##i.dem if apol_type!="long"
outreg2 using TableC-4.doc, append ctitle (Model 3 - Logit)
postest1logit
preserve
keep if apol_type!="long" 
logit_margins dv_weak i.short##i.dem, effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_weak i.short##i.dem, effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore

**Logit, binary, controls
logit dv_weak i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableC-4.doc, append ctitle (Model 6)
postest1logit
preserve
keep if apol_type!="long" 
logit_margins dv_weak i.short##i.dem `controls', effect(short) levels(dem) // Quantity C (i.e. difference in effect of short for dem vs nondem)
compare_effects dv_weak i.short##i.dem `controls', effect1(short) effect2(dem) // Quantity E (i.e. difference in effect of short when dem is 0 vs effect of dem when short is 0)
restore



**** PART 2: Effect of Victim Response (H5, H6) (no backlash)

**define program to compute quantities of interest
program define postest_rejacc
    lincom 2.apol_rejacc - 1.apol_rejacc
    lincom 1.apol_rejacc - 0.apol_rejacc
    lincom (2.apol_rejacc + 2.apol_rejacc#1.dem) - (1.apol_rejacc + 1.apol_rejacc#1.dem)
    lincom (1.apol_rejacc + 1.apol_rejacc#1.dem) - (0.apol_rejacc + 0.apol_rejacc#1.dem)
end

**generate apology IV for interaction
gen apol_rejacc=.
replace apol_rejacc=0 if apol==0
replace apol_rejacc=1 if apol==3
replace apol_rejacc=2 if apol==5


*** Favorability (Table C-6)

**OLS, binary, no controls
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-6.doc, replace ctitle (Model 1)
postest_rejacc

**OLS, binary, w/ controls
reg dv_fav i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-6.doc, append ctitle (Model 2)
postest_rejacc

**OLS, scale, no controls
reg dv_fav100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-6.doc, append ctitle (Model 3)
postest_rejacc

***OLS, scale, w/ controls
reg dv_fav100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-6.doc, append ctitle (Model 4)
postest_rejacc


*** Cooperation (Table C-7)

**OLS, binary, no controls
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-7.doc, replace ctitle (Model 1)
postest_rejacc

**OLS, binary, w/ controls
reg dv_coop i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-7.doc, append ctitle (Model 2)
postest_rejacc

**OLS, scale, no controls
reg dv_coop100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-7.doc, append ctitle (Model 3)
postest_rejacc

***OLS, scale, w/ controls
reg dv_coop100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-7.doc, append ctitle (Model 4)
postest_rejacc


*** Buy (Table C-8)

**OLS, binary, no controls
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-8.doc, replace ctitle (Model 1)
postest_rejacc

**OLS, binary, w/ controls
reg dv_buy i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-8.doc, append ctitle (Model 2)
postest_rejacc

**OLS, scale, no controls
reg dv_buy100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-8.doc, append ctitle (Model 3)
postest_rejacc

***OLS, scale, w/ controls
reg dv_buy100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-8.doc, append ctitle (Model 4)
postest_rejacc


***Weakness (Table C-9)

**OLS, binary, no controls
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-9.doc, replace ctitle (Model 1)
postest_rejacc

**OLS, binary, w/ controls
reg dv_weak i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-9.doc, append ctitle (Model 2)
postest_rejacc

**OLS, scale, no controls
reg dv_weak100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-9.doc, append ctitle (Model 3)
postest_rejacc

***OLS, scale, w/ controls
reg dv_weak100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableC-9.doc, append ctitle (Model 4)
postest_rejacc



**** PART 3: Effect of Sender Backlash (H5, H6) (w/ acceptance and w/ rejection)

**define program to compute quantities of interest
program define postest_backynA
    lincom 1.apol_backynA - 2.apol_backynA
    lincom 1.apol_backynA - 0.apol_backynA
    lincom (1.apol_backynA + 1.apol_backynA#1.dem) - (2.apol_backynA + 2.apol_backynA#1.dem)
    lincom (1.apol_backynA + 1.apol_backynA#1.dem) - (0.apol_backynA + 0.apol_backynA#1.dem)
end

program define postest_backynR
    lincom 1.apol_backynR - 2.apol_backynR
    lincom 1.apol_backynR - 0.apol_backynR
    lincom (1.apol_backynR + 1.apol_backynR#1.dem) - (2.apol_backynR + 2.apol_backynR#1.dem)
    lincom (1.apol_backynR + 1.apol_backynR#1.dem) - (0.apol_backynR + 0.apol_backynR#1.dem)
end

*generate apology IV for interaction (Accepted Apology)
gen apol_backynA=.
replace apol_backynA=0 if apol==0
replace apol_backynA=1 if apol==4
replace apol_backynA=2 if apol==5

*generate apology IV for interaction (Rejected Apology)
gen apol_backynR=.
replace apol_backynR=0 if apol==0
replace apol_backynR=1 if apol==2
replace apol_backynR=2 if apol==3


***Favorability (Table C=10)

**OLS, binary, no controls (victim accept)
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-10a.doc, replace ctitle (Model 1)
postest_backynA

**OLS, binary, w/ controls (victim accept)
reg dv_fav i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-10a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg dv_fav100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-10a.doc, append ctitle (Model 3)
postest_backynA

**OLS, scale, controls (victim accept)
reg dv_fav100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-10a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-10b.doc, replace ctitle (Model 1)
postest_backynR

**OLS, binary, w/ controls (victim reject)
reg dv_fav i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-10b.doc, append ctitle (Model 2)
postest_backynR

**OLS, scale, no controls (victim reject)
reg dv_fav100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-10b.doc, append ctitle (Model 3)
postest_backynR

**OLS, scale, controls (victim reject)
reg dv_fav100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-10b.doc, append ctitle (Model 4)
postest_backynR


***Cooperation (Table C-11)

**OLS, binary, no controls (victim accept)
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-11a.doc, replace ctitle (Model 1)
postest_backynA

**OLS, binary, w/ controls (victim accept)
reg dv_coop i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-11a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg dv_coop100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-11a.doc, append ctitle (Model 3)
postest_backynA

**OLS, scale, controls (victim accept)
reg dv_coop100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-11a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-11b.doc, replace ctitle (Model 1)
postest_backynR

**OLS, binary, w/ controls (victim reject)
reg dv_coop i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-11b.doc, append ctitle (Model 2)
postest_backynR

**OLS, scale, no controls (victim reject)
reg dv_coop100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-11b.doc, append ctitle (Model 3)
postest_backynR

**OLS, scale, controls (victim reject)
reg dv_coop100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-11b.doc, append ctitle (Model 4)
postest_backynR


***Buy (Table C-12)

**OLS, binary, no controls (victim accept)
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-12a.doc, replace ctitle (Model 1)
postest_backynA

**OLS, binary, controls (victim accept)
reg dv_buy i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-12a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg dv_buy100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-12a.doc, append ctitle (Model 3)
postest_backynA

**OLS, scale, controls (victim accept)
reg dv_buy100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableC-12a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-12b.doc, replace ctitle (Model 1)
postest_backynR

**OLS, binary, w/ controls (victim reject)
reg dv_buy i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-12b.doc, append ctitle (Model 1)
postest_backynR

**OLS, scale, no controls (victim reject)
reg dv_buy100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-12b.doc, append ctitle (Model 3)
postest_backynR

**OLS, scale, controls (victim reject)
reg dv_buy100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableC-12b.doc, append ctitle (Model 4)
postest_backynR


**** Additional Preregistered Hypotheses (H9, H10)
/*
H9 (Sender Backlash & Target Rejection, Compared to No Sender Backlash & Target Acceptance): Relative to an apology without sender backlash that is accepted by the target, an apology with sender backlash that is rejected by the target ...
i) decreases favorable views of the transgressor.
ii) decreases support for state-to-state cooperation with the transgressor.
iii) decreases willingness to transact privately with the transgressor.

H10 (Sender Backlash & Target Rejection, Compared to No Apology): Relative to no apology, an apology with sender backlash that is rejected by the target ....
i) increases favorable views of the transgressor.
ii) increases support for state-to-state cooperation with the transgressor.
iii) increases willingness to transact privately with the transgressor.
*/

*postestimation for OLS models with apol_backrej x dem interactions (Rejected Apology Backlash)
program define postest_backrej
    lincom 1.apol_backrej - 2.apol_backrej
    lincom 1.apol_backrej - 0.apol_backrej
    lincom (1.apol_backrej + 1.apol_backrej#1.dem) - (2.apol_backrej + 2.apol_backrej#1.dem)
    lincom (1.apol_backrej + 1.apol_backrej#1.dem) - (0.apol_backrej + 0.apol_backrej#1.dem)
end

*generate IV for interaction
gen apol_backrej=.
replace apol_backrej=0 if apol==0
replace apol_backrej=1 if apol==2
replace apol_backrej=2 if apol==5
		
*** Favorability (Table F-1)
**OLS, binary, no controls
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5)
outreg2 using TableF-1.doc, replace ctitle (Model 1)
postest_backrej

*** Cooperation (Table F-1)
**OLS, binary, no controls
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5)
outreg2 using TableF-1.doc, append ctitle (Model 2)
postest_backrej

*** Buy (Table F-1)
**OLS, binary, no controls
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5)
outreg2 using TableF-1.doc, append ctitle (Model 3)
postest_backrej


***Analyses not shown in appendix
**OLS, binary, controls
   foreach v of varlist dv_fav dv_coop dv_buy {
   di in r _n(2) ".......... Variable is `v' .........."
   di in r _n(2) "... OLS, binary, with controls ..."
		reg `v' apol_backrej##i.dem `controls' if (apol==0 | apol==2 | apol==5)
		postest_backrej	
   }
**OLS, scale, w/out and w/ controls
   foreach v of varlist dv_fav100 dv_coop100 dv_buy100 {
   di in r _n(2) ".......... Variable is `v' .........."
   di in r _n(2) "... OLS, scale, no controls ..."
		reg `v' apol_backrej##i.dem if (apol==0 | apol==2 | apol==5)
		postest_backrej
	di in r _n(2) "... OLS, scale, controls ..."
		reg `v' apol_backrej##i.dem `controls' if (apol==0 | apol==2 | apol==5)
	postest_backrej
   }
   

   
***********************
* MECHANISMS, STUDY 1 *
***********************

**** PART 1: Effect of Apology on Mechanisms (M1i, M1ii, M2i, M2ii, M3i, M3ii, M4i, M4ii)

*** Effect of Apology on Mediators

***Threat (Table D-1)
**binary, no controls
reg mech_threat i.short##i.dem if apol_type!="long"
outreg2 using TableD-1.doc, replace ctitle (Model 1)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**binary, controls
reg mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-1.doc, append ctitle (Model 2)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, no controls
reg mech_threat100 i.short##i.dem if apol_type!="long"
outreg2 using TableD-1.doc, append ctitle (Model 3)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, controls
reg mech_threat100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-1.doc, append ctitle (Model 4)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)

***Values (Table D-2)
**binary, no controls
reg mech_values i.short##i.dem if apol_type!="long"
outreg2 using TableD-2.doc, replace ctitle (Model 1)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**binary, controls
reg mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-2.doc, append ctitle (Model 2)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, no controls
reg mech_values100 i.short##i.dem if apol_type!="long"
outreg2 using TableD-2.doc, append ctitle (Model 3)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, controls
reg mech_values100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-2.doc, append ctitle (Model 4)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)

***Sincerity (Table D-3)
**binary, no controls
reg mech_sincere i.short##i.dem if apol_type!="long"
outreg2 using TableD-3.doc, replace ctitle (Model 1)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**binary, controls
reg mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-3.doc, append ctitle (Model 2)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, no controls
reg mech_sincere100 i.short##i.dem if apol_type!="long"
outreg2 using TableD-3.doc, append ctitle (Model 3)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, controls
reg mech_sincere100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-3.doc, append ctitle (Model 4)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)

***Status (Table D-4)
**binary, no controls
reg mech_status i.short##i.dem if apol_type!="long"
outreg2 using TableD-4.doc, replace ctitle (Model 1)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**binary, controls
reg mech_status i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-4.doc, append ctitle (Model 2)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, no controls
reg mech_status100 i.short##i.dem if apol_type!="long"
outreg2 using TableD-4.doc, append ctitle (Model 3)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)
**scale, controls
reg mech_status100 i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-4.doc, append ctitle (Model 4)
margins, dydx (short) at(dem=0)
margins, dydx (short) at(dem=1)


**** Effect of Mediators on DVs

**Threat (Table D-5)
*Fav, binary
reg dv_fav mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, replace ctitle (Model 1)
*Fav, scale
reg dv_fav100 mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, append ctitle (Model 2)
*Coop, binary
reg dv_coop mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, append ctitle (Model 3)
*Coop, scale
reg dv_coop100 mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, append ctitle (Model 4)
*Buy, binary
reg dv_buy mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, append ctitle (Model 5)
*Buy, scale
reg dv_buy100 mech_threat i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-5.doc, append ctitle (Model 6)

**Values (Table D-6)
*Fav, binary
reg dv_fav mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, replace ctitle (Model 1)
*Fav, scale
reg dv_fav100 mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, append ctitle (Model 2)
*Coop, binary
reg dv_coop mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, append ctitle (Model 3)
*Coop, scale
reg dv_coop100 mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, append ctitle (Model 4)
*Buy, binary
reg dv_buy mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, append ctitle (Model 5)
*Buy, scale
reg dv_buy100 mech_values i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-6.doc, append ctitle (Model 6)

**Sincerity (Table D-7)
*Fav, binary
reg dv_fav mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, replace ctitle (Model 1)
*Fav, scale
reg dv_fav100 mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, append ctitle (Model 2)
*Coop, binary
reg dv_coop mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, append ctitle (Model 3)
*Coop, scale
reg dv_coop100 mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, append ctitle (Model 4)
*Buy, binary
reg dv_buy mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, append ctitle (Model 5)
*Buy, scale
reg dv_buy100 mech_sincere i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-7.doc, append ctitle (Model 6)

**Status (Table D-8)
*Fav, binary
reg dv_weak mech_status i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-8.doc, replace ctitle (Model 1)
*Fav, scale
reg dv_weak100 mech_status i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-8.doc, append ctitle (Model 2)


**** PART 2: Effect of Victim Response on Mechanisms (M5i, M5ii, M6i, M6ii, M7i, M7ii, M8i, M8ii) (no backlash) 

**define program to compute quantities of interest
program define postest_rejacc2
    lincom 1.apol_rejacc - 2.apol_rejacc
    lincom 1.apol_rejacc - 0.apol_rejacc
    lincom (1.apol_rejacc + 1.apol_rejacc#1.dem) - (2.apol_rejacc + 2.apol_rejacc#1.dem)
    lincom (1.apol_rejacc + 1.apol_rejacc#1.dem) - (0.apol_rejacc + 0.apol_rejacc#1.dem)
end


**** Effect of Apology on Mediators

**Threat (Table D-11)

**OLS, binary, no controls
reg mech_threat i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-11.doc, replace ctitle (Model 1)
postest_rejacc2

**OLS, binary, w/ controls
reg mech_threat i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-11.doc, append ctitle (Model 2)
postest_rejacc2

**OLS, scale, no controls
reg mech_threat100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-11.doc, append ctitle (Model 3)
postest_rejacc2

**OLS, scale, w/ controls
reg mech_threat100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-11.doc, append ctitle (Model 3)
postest_rejacc2


**Values (Table D-12)

**OLS, binary, no controls
reg mech_values i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-12.doc, replace ctitle (Model 1)
postest_rejacc2

**OLS, binary, w/ controls
reg mech_values i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-12.doc, append ctitle (Model 2)
postest_rejacc2

**OLS, scale, no controls
reg mech_values100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-12.doc, append ctitle (Model 3)
postest_rejacc2

**OLS, scale, w/ controls
reg mech_values100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-12.doc, append ctitle (Model 4)
postest_rejacc2


**Sincere (Table D-13)

**OLS, binary, no controls
reg mech_sincere i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-13a.doc, replace ctitle (Model 1)
postest_rejacc2

**OLS, binary, w/ controls
reg mech_sincere i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-13a.doc, append ctitle (Model 2)
postest_rejacc2

**OLS, scale, no controls
reg mech_sincere100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-13a.doc, append ctitle (Model 3)
postest_rejacc2

**OLS, scale, w/ controls
reg mech_sincere100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-13a.doc, append ctitle (Model 3)
postest_rejacc2


**Status (Table D-14)

**OLS, binary, no controls
reg mech_status i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-14.doc, replace ctitle (Model 1)
postest_rejacc2

**OLS, binary, w/ controls
reg mech_status i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-14.doc, append ctitle (Model 2)
postest_rejacc2

**OLS, scale, no controls
reg mech_status100 i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-14.doc, append ctitle (Model 3)
postest_rejacc2

**OLS, scale, w/ controls
reg mech_status100 i.apol_rejacc##i.dem `controls' if (apol==0 | apol==3 | apol==5)
outreg2 using TableD-14.doc, append ctitle (Model 3)
postest_rejacc2



**** PART 3: Effect of Sender Backlash on Mechanisms (M9i, M9ii, M10i, M10ii, M11i, M11ii) (for both sender accept and sender reject) 

**** Effect of Apology on Mediators

***Threat (Table D-15)

**OLS, binary, no controls (victim accept)
reg mech_threat i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-15a.doc, replace ctitle (Model 1)
postest_backynA

**OLS, binary, controls (victim accept)
reg mech_threat i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-15a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg mech_threat100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-15a.doc, append ctitle (Model 3)
postest_backynA

**OLS, scale, controls (victim accept)
reg mech_threat100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-15a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg mech_threat i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-15b.doc, replace ctitle (Model 1)
postest_backynR

**OLS, binary, controls (victim reject)
reg mech_threat i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-15b.doc, append ctitle (Model 2)
postest_backynR 

**OLS, scale, no controls (victim reject)
reg mech_threat100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-15b.doc, append ctitle (Model 3)
postest_backynR 

**OLS, scale, controls (victim reject)
reg mech_threat100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-15b.doc, append ctitle (Model 4)
postest_backynR 


***Values (Table D-16)

**OLS, binary, no controls (victim accept)
reg mech_values i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-16a.doc, replace ctitle (Model 1)
postest_backynA 

**OLS, binary, controls (victim accept)
reg mech_values i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-16a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg mech_values100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-16a.doc, append ctitle (Model 3)
postest_backynA 

**OLS, scale, controls (victim accept)
reg mech_values100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-16a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg mech_values i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-16b.doc, replace ctitle (Model 1)
postest_backynR 

**OLS, binary, controls (victim reject)
reg mech_values i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-16b.doc, append ctitle (Model 2)
postest_backynR 

**OLS, scale, no controls (victim reject)
reg mech_values100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-16b.doc, append ctitle (Model 3)
postest_backynR 

**OLS, scale, controls (victim reject)
reg mech_values100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-16b.doc, append ctitle (Model 4)
postest_backynR 


***Sincerity (D-17)

**OLS, binary, no controls (victim accept)
reg mech_sincere i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-17a.doc, replace ctitle (Model 1)
postest_backynA

**OLS, binary, controls (victim accept)
reg mech_sincere i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-17a.doc, append ctitle (Model 2)
postest_backynA

**OLS, scale, no controls (victim accept)
reg mech_sincere100 i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-17a.doc, append ctitle (Model 3)
postest_backynA

**OLS, scale, controls (victim accept)
reg mech_sincere100 i.apol_backynA##i.dem `controls' if (apol==0 | apol==4 | apol==5)
outreg2 using TableD-17a.doc, append ctitle (Model 4)
postest_backynA

**OLS, binary, no controls (victim reject)
reg mech_sincere i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-17b.doc, append ctitle (Model 5)
postest_backynR

**OLS, binary, controls (victim reject)
reg mech_sincere i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-17b.doc, append ctitle (Model 6)
postest_backynR

**OLS, scale, no controls (victim reject)
reg mech_sincere100 i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-17b.doc, append ctitle (Model 7)
postest_backynR

**OLS, scale, controls (victim reject)
reg mech_sincere100 i.apol_backynR##i.dem `controls' if (apol==0 | apol==2 | apol==3)
outreg2 using TableD-17b.doc, append ctitle (Model 8)
postest_backynR


******************
* ELITES, STUDY 1*
******************

**** PART 1: Effect of Apology (H1a-d, H2, H3, H4, Q1, Q2) 

****For Elite 1 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite1==1
postest1
***Cooperation 
reg dv_coop i.short##i.dem if apol_type!="long" & elite1==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite1==1
postest1
***Weakness 
reg dv_weak i.short##i.dem if apol_type!="long" & elite1==1
postest1weak

****For Elite 2 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite2==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & elite2==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite2==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & elite2==1
postest1weak

****For Elite 3 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite3==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & elite3==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite3==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & elite3==1
postest1weak

****For Elite 4 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite4==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & elite4==1
margins, dydx (short) at(dem=0)
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite4==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & elite4==1
postest1weak

****For Elite 5 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite5==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & elite5==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite5==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & elite5==1
postest1weak

****For Elite 6 (Table G-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & elite6==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & elite6==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & elite6==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & elite6==1
postest1weak


**** PART 2: Effect of Victim Response (H5, H6) (no backlash) in Elite samples

***** Elite 1 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite1==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite1==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite1==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite1==1
postest_rejacc

***** Elite 2 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite2==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite2==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite2==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite2==1
postest_rejacc

***** Elite 3 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite3==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite3==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite3==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite3==1
postest_rejacc

***** Elite 4 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite4==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite4==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite4==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite4==1
postest_rejacc

***** Elite 5 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite5==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite5==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite5==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite5==1
postest_rejacc


***** Elite 6 (Table G-1)
***Favorability 
reg dv_fav i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite6==1
postest_rejacc
***Cooperation 
reg dv_coop i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite6==1
postest_rejacc
***Buy 
reg dv_buy i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite6==1
postest_rejacc
***Weakness 
reg dv_weak i.apol_rejacc##i.dem if (apol==0 | apol==3 | apol==5) & elite6==1
postest_rejacc


***** PART 3: The Effect of Sender Backlash (accept, reject) in Elite Samples

***** Elite 1 (Table G-1)
***Favorability 
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite1==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite1==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite1==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite1==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite1==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite1==1
postest_backynR

***** Elite 2 (Table G-1)
***Favorability
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite2==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite2==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite2==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite2==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite2==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite2==1
postest_backynR

***** Elite 3 (Table G-1)
***Favorability
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite3==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite3==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite3==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite3==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite3==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite3==1
postest_backynR

***** Elite 4 (Table G-1)
***Favorability
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite4==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite4==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite4==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite4==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite4==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite4==1
postest_backynR

***** Elite 5 (Table G-1)
***Favorability
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite5==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite5==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite5==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite5==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite5==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite5==1
postest_backynR

***** Elite 6 (Table G-1)
***Favorability
**accept
reg dv_fav i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite6==1
postest_backynA
***Cooperation
**accept
reg dv_coop i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite6==1
postest_backynA
***Buy
**accept
reg dv_buy i.apol_backynA##i.dem if (apol==0 | apol==4 | apol==5) & elite6==1
postest_backynA
***Favorability
**reject
reg dv_fav i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite6==1
postest_backynR
***Cooperation
**reject
reg dv_coop i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite6==1
postest_backynR
***Buy
**reject
reg dv_buy i.apol_backynR##i.dem if (apol==0 | apol==2 | apol==3) & elite6==1
postest_backynR


***** Additional Preregistered Hypotheses (H9, H10) (not shown in appendix)

***** Elite 1 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite1==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite1==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite1==1
postest_backrej

***** Elite 2 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite2==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite2==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite2==1
postest_backrej

***** Elite 3 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite3==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite3==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite3==1
postest_backrej

***** Elite 4 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite4==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite4==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite4==1
postest_backrej

***** Elite 5 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite5==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite5==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite5==1
postest_backrej

***** Elite 6 
*** Favorability 
reg dv_fav apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite6==1
postest_backrej
*** Cooperation 
reg dv_coop apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite6==1
postest_backrej
*** Buy 
reg dv_buy apol_backrej##i.dem if (apol==0 | apol==2 | apol==5) & elite6==1
postest_backrej


  
******************************
* SUBGROUP ANALYSIS, STUDY 1 *
******************************

**** PART 1: Effect of Apology (H1a-d, H2, H3, H4, Q1, Q2) 

****For Republican (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & pid3==3
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & pid3==3
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & pid3==3
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & pid3==3
postest1weak

****For Democrat (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & pid3==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & pid3==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & pid3==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & pid3==1
postest1weak

****For Independent (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & pid3==2
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & pid3==2
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & pid3==2
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & pid3==2
postest1weak

**** create hawk and dove dummies
drop hawk
drop dove
tab hawk5_f
gen hawk=0
replace hawk=1 if hawk5_f>=4
gen dove=0
replace dove=1 if hawk5_f<=2

****For Hawk (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & hawk==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & hawk==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & hawk==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & hawk==1
postest1weak

****For Dove (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & dove==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & dove==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & dove==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & dove==1
postest1weak

****For Russia enemy (Table H-1)
***Favorability
reg dv_fav i.short##i.dem if apol_type!="long" & enemy2==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & enemy2==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & enemy2==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & enemy2==1
postest1weak

****For Russia not enemy (Table H-1)
***Favorability
reg dv_fav i.short##i.dem if apol_type!="long" & enemy2==0
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & enemy2==0
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & enemy2==0
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & enemy2==0
postest1weak

****For Men (Table H-1)
***Favorability
reg dv_fav i.short##i.dem if apol_type!="long" & male==1
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & male==1
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & male==1
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & male==1
postest1weak

****For Women/nonbinary (Table H-1)
***Favorability 
reg dv_fav i.short##i.dem if apol_type!="long" & male==0
postest1
***Cooperation
reg dv_coop i.short##i.dem if apol_type!="long" & male==0
postest1
***Buy
reg dv_buy i.short##i.dem if apol_type!="long" & male==0
postest1
***Weakness
reg dv_weak i.short##i.dem if apol_type!="long" & male==0
postest1weak



********************************************************************************************************************
*************************************************** Study 2 ********************************************************
********************************************************************************************************************

clear
use "raw_data_Study_2.dta" // load raw data


**********************************************************************************************************************************
******************************************** 4) Processing of data from Study 2 **************************************************
**********************************************************************************************************************************

****************************************
* CLEAN UP DATA AND GENERATE VARIABLES *
****************************************

keep if status==0 // drop the previews
count 


*********************************
* PRETREATMENT ATTENTION CHECKS *
*********************************

foreach x in 1 2 3 4 5 6 {
ren attn`x'p attn`x'pass
gen attn`x'p=0
replace attn`x'p=1 if attn`x'pass=="pass"
}
gen passpresum=attn1p + attn2p + attn3p + attn4p + attn5p + attn6p
tab passpresum

keep if passpresum==6 // they got screened out anyway, but drop for clarity
count


**************
* TREATMENTS *
**************

* process treatment indicators 
* whether the sender (apologizer) is a democracy
gen dem=0
replace dem=1 if regime1=="democracy" // dem=1 if sender is democratic
tab dem regime1, nomiss

* whether there is an apology 
tab apol_type
gen apol=-1 // explicit no apology
replace apol = 0  if apol_type=="nomention" // no mention
replace apol = 1 if apol_type=="short" // apology
label define apoll -1 "Explicit no apol" 0 "No mention" 1 "Short apol" 
label values apol apoll
tab apol 

* create apology treatment indicators
gen short=0
replace short=1 if apol==1 // an apology was issued

gen nomention=0
replace nomention=1 if apol==0 // the speech did not mention an apology or no apology

gen noexpl=0
replace noexp=1 if apol==-1 // explicit statemeny of no apology


***********************
* DEPENDENT VARIABLES *
***********************

* Favorability
/*If events in 2030 happened just as we described, would you have a very favorable, somewhat favorable, somewhat unfavorable, or very unfavorable view of Russia? 
o	Very favorable  (1) 
o	Somewhat favorable  (2) 
o	Somewhat unfavorable  (3) 
o	Very unfavorable  (4) 
*/
tab dv1_fav
* binary-- primary operationalization
gen dv_fav=0
replace dv_fav=100 if dv1_fav==1 | dv1_fav==2 // favorable=100 if very or somewhat favorable
tab dv_fav
* scale-- for robustness check
gen dv_fav100=dv1_fav
recode dv_fav100 1=100 2=66.67 3=33.33 4=0 // 4-point scale of favorability
tab dv_fav100

* Cooperation
/*If events in 2030 happened just as we described, would you say that the U.S. should increase, decrease, or not change its level of cooperation with Russia?
o	Increase its level of cooperation  (1) 
o	Not change its level of cooperation  (2) 
o	Decrease its level of cooperation  (3) 
*/
tab dv2_coop_1
* binary-- primary operationalization
gen dv_coop=0
replace dv_coop=100 if dv2_coop_1==1 // cooperation=100 if increase coop 
tab dv_coop
* scale-- for robustness check
gen dv_coop100=dv2_coop_1
recode dv_coop100 1=100 2=50 3=0 // 100 is increase, 50 is not change, 0 is decrease
tab dv_coop100

* Buy
/*If events in 2030 happened just as we described, would you avoid buying products that you knew had been made in Russia?
o	Would definitely avoid buying  (1) 
o	Would probably avoid buying  (2) 
o	Would probably not avoid buying  (3) 
o	Would definitely not avoid buying  (4) 
*/
tab dv3_products 
* binary-- primary operationalization
gen dv_buy=0
replace dv_buy=100 if dv3_products>=3 // buy=100 if definitely not or probably not avoid buying
tab dv_buy
* scale-- for robustness check
gen dv_buy100=dv3_products
recode dv_buy100 1=0 2=33.33 3=66.67 4=100 // scale means more support for buying
tab dv3_products dv_buy100

* Weakness (Study 2)
/*If events in 2030 happened just as we described, would you agree or disagree with the following statement? "Russia is a weak country."
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
tab dv1_weak_1
* binary-- primary operationalization
gen dv_weak=0
replace dv_weak=100 if dv1_weak_1<=2 // weak=100 if agree strongly or somewhat that "Russia is a weak country"
tab dv_weak
* scale-- for robustness check
gen dv_weak100=dv1_weak_1
recode dv_weak100 5=0 4=25 3=50 2=75 1=100 // scale means more perceptions of weakness
tab dv1_weak_1 dv_weak100


**************
* MECHANISMS *
**************

* threat
/*If events in 2030 happened just as we described, would you agree or disagree that Russia represents a threat to international peace and stability?
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
tab mech_threat_1
* binary-- primary operationalization
gen mech_threat=0
replace mech_threat=100 if mech_threat_1<=2 // threat=100 if agree strongly or somewhat that Russia represents threat
* scale-- for robustness check
gen mech_threat100=mech_threat_1
recode mech_threat100 1=100 2=75 3=50 4=25 5=0 // scale means more perception of threat
tab mech_threat100 mech_threat_1

* values
/*If events in 2030 happened just as we described, how much confidence would you have that Russia will generally "do the right thing" in world affairs?
o	A lot of confidence  (1)  o	Some confidence  (2)  o	Not too much confidence  (3)  o	No confidence at all  (4)  */
tab mech_values_1
* binary-- primary operationalization
gen mech_values=0
replace mech_values=100 if mech_values_1<=2 // values=100 if some or a lot of confidence
* scale-- for robustness check
gen mech_values100=mech_values_1
recode mech_values100 4=0 3=33.33 2=66.67 1=100 // scale means more perception of values
tab mech_values100 mech_values_1

* military power
/*If events in 2030 happened just as we described, would you agree or disagree with the following statement? "Russia has a lot of military power."
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
tab mech_mil
* binary-- primary operationalization
ren mech_mil mech_mil_orig
gen mech_mil=0
replace mech_mil=100 if mech_mil_orig<=2 // mil=100 if agree strongly or somewhat that Russia has a lot of mil power
tab mech_mil mech_mil_orig
* scale-- for robustness check
gen mech_mil100=mech_mil_orig
recode mech_mil100 1=100 2=75 3=50 4=25 5=0 // scale means stronger perception of mil power
tab mech_mil100 mech_mil_orig

* status
/*If events in 2030 happened just as we described, how much would you agree or disagree with the following statement? "Russia has a lot of status internationally."
Agree strongly (1) Agree somewhat (2) Neither agree nor disagree (3) Disagree somewhat (4) Disagree strongly (5) */
* binary-- primary operationalization
gen mech_status=0
replace mech_status=100 if mech_status_1<=2 // status=100 if agree strongly or somewhat
tab mech_status mech_status_1
* scale-- for robustness check 
gen mech_status100=mech_status_1
recode mech_status100 1=100 2=75 3=50 4=25 5=0 // scale means higher status
tab mech_status100 mech_status_1

* sincerity 
/*If events in 2030 happened just as we described, would you agree or disagree that Russia feels that its invasion of Ukraine was wrong?
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
tab mech_sincere_1
* binary-- primary operationalization
gen mech_sincere=0
replace mech_sincere=100 if mech_sincere_1<=2 // sincere=100 if agree strongly or somewhat
tab mech_sincere mech_sincere_1
* scale-- for robustness check 
gen mech_sincere100=mech_sincere_1
recode mech_sincere100 1=100 2=75 3=50 4=25 5=0 // scale means stronger perception of sincerity
tab mech_sincere100 mech_sincere_1


**************
* COVARIATES *
**************

* Note: we collected and coded the covariates but did not preregister analyses that used them.

* ideology (MW)
/*In general, do you think of yourself as . . .
o	Extremely liberal  (1) 
o	Liberal  (2) 
o	Slightly liberal  (3) 
o	Moderate, middle of the road  (4) 
o	Slightly conservative  (5) 
o	Conservative  (6) 
o	Extremely conservative  (7) 
*/
gen conservative=ideo7 // lower values mean more liberal, higher values more conservative
tab conservative, miss

* party (Lucid)
/*"Generally Speaking, do you usually think yourself as a Republican, a Democrat, an Independent, or what?",,
political_party,1,Strong Democrat
political_party,2,Not very strong Democrat
political_party,3,Independent Democrat
political_party,4,Independent - neither
political_party,5,Independent Republican
political_party,6,Other - leaning Democrat
political_party,7,Other - neither
political_party,8,Other - leaning Republican
political_party,9,Not very strong Republican
political_party,10,Strong Republican
*/
gen pid10=political_party
tab pid10, miss

* male (Lucid, "gender")
tab gender, miss
gen male = cond(gender == 1,1,0) // male-identifying respondent
label define malel 1 "Male" 0 "Other"
label values male malel

* age (Lucid, "in years") 
tab age, miss // age in years

* race (Lucid, "ethnicity")
label define racel 1 "White" 2 "Black, or African American" 3 "American Indian or Alaska Native" 4 "Asian *** Asian Indian" 5 "Asian *** Chinese"  6 "Asian *** Filipino"  7 "Asian *** Japanese"  8 "Asian *** Korean" 9 "Asian *** Vietnamese" 10 "Asian *** Other" 11 "Pacific Islander *** Native Hawaiian"  12 "Pacific Islander *** Guamanian" 13 "Pacific Islander *** Samoan " 14 "Pacific Islander *** Other Pacific Islander" 15 "Some other race" 16	"Prefer not to answer" 
label values ethnicity racel
tab ethnicity, miss
gen white = cond(ethnicity == 1,1,0) // responent identifies as white
tab white

* education (Lucid, "education")
tab education, miss
replace education=. if educ<0
label define educll 1 "Some high school or less" 2 "High School Grad" 3 "Other post high school vocational" 4 "Some college" 5 "Associate's degree" 6 "Bachelor's degree" 7 "Master's or professional degree" 8 "PhD"
label values education educll
gen college=0
replace college=1 if education>=6 // college degree or no (doesn't count those in college)
tab college education

* hawkishness (MW)
/*The use of military force only makes problems worse. 
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
rename hawk5 hawk5_f
gen hawk5= (hawk5_f-1)/4 // // 0-1 scale of hawkishness, with higher values meaning more hawkish
tab hawk5

* international trust (MW)
/*Generally speaking, the U.S. can trust other nations. 
o	Agree strongly  (1)  o	Agree somewhat  (2)  o	Neither agree nor disagree  (3)  o	Disagree somewhat  (4)  o	Disagree strongly  (5)  */
recode trust 5=0 4=1 3=2 2=3 1=4 // recode do that higher values = greater trust
rename trust trust_f
gen trust= (trust_f-1)/4 // 0-1 scale of international trust, with higher values meaning more trust
tab trust

* political interest (MW)
/*Would you say you follow what's going on in government and public affairs...?
o	Most of the time  (1) 
o	Some of the time  (2) 
o	Only now and then  (3) 
o	Hardly at all  (4) 
o	Don't know  (5) 
*/
gen polint = newsint
recode polint 4=0 3=1 2=2 1=3 5=0 *=. // recode so that higher values = more interest 
rename polint polint_f
label define polint_fl 0 "Hardly at all" 1 "Only now and then" 2 "Some of the time" 3 "Most of the time"
label values polint_f polint_fl
gen polint= polint_f/3 // 0-1 scale of political interest, with higher values meaning more political interest
tab polint polint_f

* political activism (MW)
/*During the past year did you ... (Please check all that apply)
▢	Attend local political meetings (such as school board or city council)  (1) 
▢	Put up a political sign (such as a lawn sign or a bumper sticker)  (2) 
▢	Work for a candidate or campaign  (3) 
▢	Donate money to a candidate, campaign, or political organization  (4) 
▢	Donate blood  (5) 
▢	None of these  (6) 
Did you vote in the presidential election in November 2020?
o	No  (1) 
o	I usually vote, but did not in 2020  (2) 
o	I am not sure  (3) 
o	Yes. I definitely voted.  (4) 
Did you vote in the congressional election in November 2022?
o	No  (1) 
o	I usually vote, but did not in 2022  (2) 
o	I am not sure  (3) 
o	Yes. I definitely voted.  (4) 
*/
tab particip
rename particip particip_string
foreach x in  1 2 3 4 5 {
gen particip_`x'=0
replace particip_`x'=1 if strpos(particip_s, "`x'")
}
egen particip_f = rowtotal(particip_1 particip_2 particip_3 particip_4) // create count, but ignore donate blood = particip_5
gen particip = particip_f/4 // higher scores reflect greater political interest
tab particip
recode voted20 4=1 1/3=0 *=. // voted=1 if yes in 2020
recode voted18 4=1 1/3=0 *=. // voted=1 if yes in 2022
tab voted20
tab voted18

* relig (MW)
/*How important is religion in your life?
o	Very important  (1) 
o	Somewhat important  (2) 
o	Not too important  (3) 
o	Not at all important  (4) 
*/
recode relig_impt 4=1 3=2 2=3 1=4 *=. // higher values = religion more important
rename relig_impt relig_impt_f
gen relig_impt= (relig_impt_f - 1)/3 // 0-1 scale, with higher values meaning more religious
tab relig_impt

* Russia perceptions (MW)
/*Please say whether you consider Russia an ally of the United States, friendly, but not an ally, unfriendly, or an enemy of the United States.
o	Ally  (1) 
o	Friendly, but not an ally  (2) 
o	Unfriendly  (3) 
o	Enemy  (4) 
o	No opinion  (5) 
*/
gen enemy2 = 0
replace enemy2 = 1 if enemy_russia== 3 | enemy_russia==4 // enemy=1 if "unfriendly" or "enemy", codes no opinion as not enemy
tab enemy2 
label define enemy2l 0 "Not Enemy/Unfriendly" 1 "Enemy/Unfriendly"
label values enemy2 enemy2l


* Generalizability analysis

* commitment to democratic norms
/*For each of the items below, please choose the response that is closest to your view. (Agree strongly (1)	Agree somewhat (2)	Neither agree nor disagree (3)	Disagree somewhat (4)	Disagree strongly (5))
- demnorms_1: I do not mind a politician's methods if he or she manages to get the right things done. // higher = better dem norms
- demnorms_2: When the country is in great danger, it is often necessary for political leaders to act boldly, even if this means overstepping the usual processesof government decision-making. // higher = better dem norms
- demnorms_3: People should be allowed to vote even if they are badly misinformed on basic facts about politics. // higher = worse dem norms
- demnorms_4: People who hate my way of life should still have a chance to talk in a public forum. // higher = worse dem norms]]
*/
recode demnorms_3 5=1 4=2 3=3 2=4 1=5 // reverse direction so higher= better dem norms
recode demnorms_4 5=1 4=2 3=3 2=4 1=5 // reverse direction so higher= better dem norms
gen demnorms=0
replace demnorms= demnorms_1+ demnorms_2 + demnorms_3 + demnorms_4
tab demnorms
replace demnorms=(demnorms-4)/16 // higher means better demnorms
tab demnorms
sum demnorms, d
* high vs low democratic norms
gen demnormslow=0
replace demnormslow=1 if demnorms<.56 // demnormslow if 50th percentile or below
label define demnormsl 0 "High dem norms" 1 "Low dem norms"
label values demnormslow demnormsl
tab demnormslow

* rightwing attitudes 
/*In politics people often talk of "left" and "right". On a scale of 1 (left) and 10 (right), where would you classify your own political views?
*/
sum left, d // median is 5, so per PAP, "right-wing" would be 5 or above
gen right=0
replace right=1 if left>=5 // right=1 if 50th percentile or above
tab right

* authoritarianism question
/* Please indicate the level of your agreement with the statements below. Agree strongly (2) Agree somewhat (3) Neither agree nor disagree (4)	Disagree somewhat (5) Disagree strongly (6)
- auth_1: It's great that many young people today are prepared to defy authority. // higher = higher on auth
- auth_2: What our country needs most is discipline, with everyone following our leaders in unity. // higher = low on auth 
- auth_3: God's laws about abortion, pornography, and marriage must be strictly followed before it is too late. // higher = lower on auth
- auth 4: There is nothing wrong with premarital sexual intercourse. // higher = high on auth
- auth_5: Our society does NOT need tougher government and stricter laws. // higher = higher on auth
- auth_6: The facts on crime and the recent public disorders show we have to crack down harder on troublemakers, if we are going preserve law and order. // higher = lower on auth
*/
foreach x in 1 2 3 4 5 6 {
ren auth_`x' auth`x'
gen auth`x'_orig=auth`x'
replace auth`x'=auth`x'-2 //correct values to start w/ 0
}
foreach x in 2 3 6 { // reverse code for the measure where higher= lower auth 
recode auth`x' 0=4 1=3 2=2 3=1 4=0
}
foreach x in 1 2 3 4 5 6 {
	tab auth`x' auth`x'_orig
}

gen authscale=auth1+auth2+auth3+auth4+auth5+auth6 // scale of authoritarianism
replace authscale=authscale/24
tab authscale
sum authscale, d

* high / not-high on authoritarianism
gen highauth=0
replace highauth=1 if authscale>=0.54 // 50th percentile or above
label define highauthl 0 "Low authoritarianism" 1 "High authoritarianism"
label values highauth highauthl
tab highauth


**********************************
* POSTTREATMENT ATTENTION CHECKS *
**********************************
* diagnostic, not used to screen out respondents
gen mck_gen=mck_rel_1 // 1
gen mck_reg=scen2_mck_1 
gen mck_apol=scen3_mck_1 
tab mck_gen
tab mck_reg
tab mck_apol

***********
* DUMMIES *
***********

*** gen dummies
gen demshort=0
replace demshort=1 if dem==1 & short==1
label var demshort "Democracy, Short Apology"
tab apol dem, sum(demshort)

gen demnom=0
replace demnom=1 if dem==1 & nomention==1
label var demnom "Democracy, No Mention"
tab apol dem, sum(demnom)

gen demnoexpl=0
replace demnoexpl=1 if dem==1 & noexpl==1
label var demnoexpl "Democracy, Explicit No"
tab apol dem, sum(demnoe)

gen autshort=0
replace autshort=1 if dem==0 & short==1
label var autshort "Non-Democracy, Short Apology"
tab apol dem, sum(autshort)

gen autnom=0
replace autnom=1 if dem==0 & nomention==1
label var autnom "Non-Democracy, No Mention"
tab apol dem, sum(autnom)

gen autnoexpl=0
replace autnoexpl=1 if dem==0 & noexpl==1
label var autnoexpl "Non-Democracy, Explicit No"
tab apol dem, sum(autnoe)


***Save prepared data for making figures (in R) and appendix tables (in Stata)
count
save "Study2_prepped.dta", replace


***************************************************************************************************************************************
*************************************************** 5) MAIN ANALYSES OF STUDY 2 *******************************************************
***************************************************************************************************************************************

* see R code to generate Figure 2

* Step 1: What is the effect of an apology (short apology) relative to no apology? (Tested again on Study 2)

* H1: Effect of Apology. Relative to no apology, an apology…
* a)	(Favorability) increases favorable views of the transgressor = dv_fav
* b)	(State-to-State Cooperation) increases support for state-to-state cooperation with the transgressor = dv_coop
* c)	(Private Transactions) increases willingness to transact privately with the transgressor = dv_buy
* d)	(Weakness): increases perceptions of weakness of the transgressor = dv_weak


foreach v of varlist dv_fav dv_coop dv_buy dv_weak {
   di in r _n(2) ".......... Variable is `v' .........."
   di in r _n(2) "... OLS, binary, no controls ..."
		reg `v' autnoexpl autnom autshort demnoexpl demnom demshort  , noconst
		lincom autshort-autnom
lincom autshort-autnoexpl
lincom demshort-demnom
lincom demshort-demnoexpl
lincom (demshort-demnom)-(autshort-autnom)
lincom (demshort-demnoexpl)-(autshort-autnoexpl)
lincom demnom-autnom 
lincom demnoexpl-autnoexpl 
   }
 
***************************************************************************************************************************************
*************************************************** 6) SUPPLEMENTAL ANALYSES OF STUDY 2 ***********************************************
***************************************************************************************************************************************

*************************
* DESCRIPTIVES, STUDY 2 *
*************************

tab enemy2
tab male
gen plus40=0
replace plus40=1 if age>39
tab plus40
gen below40=0
replace below40=1 if age<40
tab below40
tab right
tab highauth 
tab demnormslow


**********************************************************************************************************************************
******************************************** CODE TO CREATE APPENDIX TABLES, STUDY 2 *********************************************
**********************************************************************************************************************************

**************************
* MAIN ANALYSIS, STUDY 2 *
**************************

**** PART 1: Effect of Apology (H1a-d, H2, H3, H4, Q1, Q2) 

*** recode IV for interaction
recode apol (-1=0) (0=1) (1=2)
label define apoll 0 "explicit no" 1 "no mention" 2 "short apology", modify
label values apol apoll 

* program for postestimation commands for study 2
program define postest2
lincom 2.apol- 1.apol //A1
lincom 2.apol- 0.apol //A2
lincom (2.apol + 2.apol#1.dem) - (1.apol + 1.apol#1.dem) //B1
lincom (2.apol + 2.apol#1.dem) - (0.apol + 0.apol#1.dem) //B2
lincom (2.apol#1.dem - 1.apol#1.dem) - (2.apol#0.dem - 1.apol#0.dem) //C1
lincom (2.apol#1.dem - 0.apol#1.dem) - (2.apol#0.dem - 0.apol#0.dem) //C2
lincom (1.dem + 1.apol#1.dem) - (0.dem + 1.apol#0.dem) //D1
lincom 1.dem- 0.dem //D2
lincom (2.apol - 1.apol) - ((1.dem + 1.apol#1.dem) - (0.dem + 1.apol#0.dem)) //E1
lincom 2.apol  -  1.dem //E2
end

* program for poestimation for study 2, weakness
program define postest2weak
lincom 2.apol- 1.apol //A1
lincom 2.apol- 0.apol //A2
lincom (2.apol + 2.apol#1.dem) - (1.apol + 1.apol#1.dem) //B1
lincom (2.apol + 2.apol#1.dem) - (0.apol + 0.apol#1.dem) //B2
lincom (2.apol#1.dem - 1.apol#1.dem) - (2.apol#0.dem - 1.apol#0.dem) //C1
lincom (2.apol#1.dem - 0.apol#1.dem) - (2.apol#0.dem - 0.apol#0.dem) //C2
*lincom (1.dem + 1.apol#1.dem) - (0.dem + 1.apol#0.dem) //D1
*lincom 1.dem- 0.dem //D2
lincom (2.apol - 1.apol) - ((1.dem + 1.apol#1.dem) - (0.dem + 1.apol#0.dem)) //E1
lincom 2.apol  -  1.dem //E2
end

***Favorability (Table C-5)
**OLS, binary, no controls
reg dv_fav i.apol##i.dem 
outreg2 using TableC-5.doc, replace ctitle (Model 1)
postest2

***Cooperation Table C-5)
**OLS, binary, no controls
reg dv_coop i.apol##i.dem 
outreg2 using TableC-5.doc, append ctitle (Model 2)
postest2

***Buy Table C-5)
**OLS, binary, no controls
reg dv_buy i.apol##i.dem 
outreg2 using TableC-5.doc, append ctitle (Model 3)
postest2

***Weakness Table C-5)
**OLS, binary, no controls
reg dv_weak i.apol##i.dem 
outreg2 using TableC-5.doc, append ctitle (Model 4)
postest2weak


**********************
* MECHANISMS, STUDY 2*
**********************

* program for postestimation commands 
program define postestmed2
lincom 2.apol- 1.apol 
lincom 2.apol- 0.apol 
lincom (2.apol + 2.apol#1.dem) - (1.apol + 1.apol#1.dem) 
lincom (2.apol + 2.apol#1.dem) - (0.apol + 0.apol#1.dem)
end


**** PART 1: Effect of Apology (M1i, M2i, M3i, M4i, MXi, MMXii) 

***Effect of Apology on Mediators (Table D-9)

***Threat 
**OLS, binary, no controls
reg mech_threat i.apol##i.dem
outreg2 using TableD-9.doc, replace ctitle (Model 1)
postestmed2

***Values 
**OLS, binary, no controls
reg mech_values i.apol##i.dem
outreg2 using TableD-9.doc, append ctitle (Model 2)
postestmed2

***Sincerity 
**OLS, binary, no controls
reg mech_sincere i.apol##i.dem
outreg2 using TableD-9.doc, append ctitle (Model 3)
postestmed2

***Status 
**OLS, binary, no controls
reg mech_status i.apol##i.dem
outreg2 using TableD-9.doc, append ctitle (Model 4)
postestmed2

***Military 
**OLS, binary, no controls
**# Bookmark #1
reg mech_mil i.apol##i.dem
outreg2 using TableD-9.doc, append ctitle (Model 5)
postestmed2

***Effect of Mediator on DV

**Mil Pow (Table D-10)
*weakness, binary
reg dv_weak mech_mil i.short##i.dem `controls' if apol_type!="long"
outreg2 using TableD-10.doc, replace ctitle (Model 1)


*****************************
* SUBGROUP ANALYSIS, STUDY 2*
*****************************

**** PART 1: Effect of Apology (H1a-d, H2, H3, H4, Q1, Q2) 

***** For Men (Table H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if male==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if male==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if male==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if male==1
postest2weak

***** For Women/nonbinary (TABLE H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if male==0
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if male==0
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if male==0
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if male==0
postest2weak

***** For 40yrs and over (TABLE H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if plus40==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if plus40==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if plus40==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if plus40==1
postest2weak

*****For Under 40 (TABLE H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if below40==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if below40==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if below40==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if below40==1
postest2weak

***** For Russia Enemy (TABLE H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if enemy2==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if enemy2==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if enemy2==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if enemy2==1
postest2weak

***** For Russia Not Enemy (TABLE H-2)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if enemy2==0
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if enemy2==0
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if enemy2==0
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if enemy2==0
postest2weak

***** For Low authoritarianism (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if highauth==0
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if highauth==0
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if highauth==0
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if highauth==0
postest2weak

***** For High authoritarianism (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if highauth==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if highauth==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if highauth==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if highauth==1
postest2weak


***** For Low Right Wing (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if right==0
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if right==0
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if right==0
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if right==0
postest2weak


***** For High Right Wing (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if right==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if right==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if right==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if right==1
postest2weak

***** For Low Democratic Norms (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if demnormslow==1
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if demnormslow==1
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if demnormslow==1
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if demnormslow==1
postest2weak

***** For High Democratic Norms (Table H-3)
***Favorability 
**OLS, binary, no controls
reg dv_fav i.apol##i.dem if demnormslow==0
postest2
***Cooperation 
**OLS, binary, no controls
reg dv_coop i.apol##i.dem if demnormslow==0
postest2
***Buy 
**OLS, binary, no controls
reg dv_buy i.apol##i.dem if demnormslow==0
postest2
***Weakness 
**OLS, binary, no controls
reg dv_weak i.apol##i.dem if demnormslow==0
postest2weak








